package com.goldze.mvvmhabit.viewadapter;

import android.databinding.BindingAdapter;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.goldze.mvvmhabit.R;


public class ImageViewAttrAdapter {

    @BindingAdapter("imageUrl")
    public static void loadImage(ImageView imageView, String imageUrl) {
        RequestOptions options = new RequestOptions().placeholder(R.mipmap.default_head_icon);
        Glide.with(imageView.getContext()).applyDefaultRequestOptions(options).load(imageUrl).into(imageView);
    }
}
